package com.example.springboot01.h5controller;


import com.example.springboot01.entity.TimeTable;
import com.example.springboot01.service.TimeTableService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController //注解。告诉系统帮我们做什么事情
//@Controller
//系统把所有含有@RestController和@Controller注解的都表示为控制器。
//url发送过来的请求都到含有这这注解的类里面去查找。
//在@RequestMapping里面找到和url发送过来的名字一模一样的。就表示查到了
//否则没查到。返回404.
public class CTimeTable {
    //请求名,用于接受网页上或者小程序。h5发送过来的url数据
    //例如：http://192.168.1.232:8080/qry_time_table
    @RequestMapping("qry_time_table")
    public TimeTable qryTimeTable(HttpServletRequest request){
        String no = request.getParameter("x_no");
        String password = request.getParameter("pwd");
        String stuTerm = request.getParameter("term");
        System.out.println("no:" + no);
        System.out.println("password:" + password);
        System.out.println("stuTerm:" + stuTerm);

//        //生成一门课的信息记录
//        TimeTable timeTable = new TimeTable();
//        timeTable.setCourseName("javaEE程序设计");
//        timeTable.setTeacherName("唐红军");
//        timeTable.setRoom("C111");
//        timeTable.setXqj("礼拜2");
//        timeTable.setStart(8);
//        timeTable.setLength(5);
//        System.out.println(timeTable.toString());
        TimeTableService timeTableService = new TimeTableService();
        //timeTableService.qryTimeTable这种形式就是调用前面定义好的函数
        TimeTable timeTable = timeTableService.qryTimeTable(no, password, stuTerm);

        return timeTable;
    }
    @RequestMapping("qry_student_grade_table")
    public String qryStudentGradeTable(){
        return "这是我的成绩表";
    }
}
